home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / network / if-up.d / avahi-daemon < prev    next >
Encoding:
Text File  |  2007-03-27  |  2.0 KB  |  57 lines

  1. #!/bin/sh
  2.  
  3. # Don't run the avahi-daemon unicast local check while bringing up
  4. # the loopback device; it's not necessary until we bring up a real network
  5. # device, and we do those in the background so they don't hold up the
  6. # boot process
  7. [ "$IFACE" != "lo" ] || exit 0
  8.  
  9. # don't bother if /etc/default/avahi-daemon says it is disabled
  10. AVAHI_DAEMON_START=1
  11. test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon
  12.  
  13. if [ "$AVAHI_DAEMON_START" != "1" ] || [ "$MODE" != "start" ] || ! /usr/sbin/avahi-daemon -c; then
  14.     exit 0
  15. fi
  16.  
  17. # If we have an unicast .local domain, we immediately disable avahi to avoid
  18. # conflicts with the multicast IP4LL .local domain
  19. DISABLE_TAG_DIR="/var/run/avahi-daemon/"
  20. DISABLE_TAG="$DISABLE_TAG_DIR/disabled-for-unicast-local"
  21.  
  22. # Bail out if resolvconf is installed
  23. [ -x /sbin/resolvconf ] && exit 0
  24.  
  25. OUT=`LC_ALL=C host -t soa local. 2>&1`
  26.  
  27. if [ $? -eq 0 ] && echo "$OUT" | egrep -vq 'has no|not found'; then
  28.     if [ -x /etc/init.d/avahi-daemon ]; then
  29.         /etc/init.d/avahi-daemon stop || true
  30.         if [ -x /usr/bin/logger ]; then
  31.             logger -p daemon.warning -t avahi <<EOF
  32. Avahi detected that your currently configured local DNS server serves
  33. a domain .local. This is inherently incompatible with Avahi and thus
  34. Avahi disabled itself. If you want to use Avahi in this network, please
  35. contact your administrator and convince him to use a different DNS domain,
  36. since .local should be used exclusively for Zeroconf technology.
  37. For more information, see http://avahi.org/wiki/AvahiAndUnicastDotLocal
  38. EOF
  39.         fi
  40.     fi
  41.     if [ ! -d ${DISABLE_TAG_DIR} ] ; then 
  42.       mkdir -m 0755 -p ${DISABLE_TAG_DIR}
  43.       chown avahi:avahi ${DISABLE_TAG_DIR}
  44.     fi 
  45.     touch ${DISABLE_TAG}
  46. else
  47.     # no unicast .local conflict, so remove the tag and start avahi again
  48.     if [ -e ${DISABLE_TAG} ]; then
  49.         rm -f ${DISABLE_TAG}
  50.         if [ -x /etc/init.d/avahi-daemon ]; then
  51.             /etc/init.d/avahi-daemon start || true
  52.         fi
  53.     fi
  54. fi
  55.  
  56. exit 0
  57.